package com.javapub.flowable.myflowable.pojo;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

import javax.validation.constraints.AssertTrue;
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import javax.validation.constraints.Past;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import com.fasterxml.jackson.annotation.JsonFormat;

import lombok.Data;

@Data
public class Person {
    @Null(message = "必须为空的方式")
    private String name;
    @NotNull(message = "不能为空")
    private String address;
    @NotNull(message = "不能为空age")
    private Integer age;
    @AssertTrue(message = "必须使用true")
    private Boolean flag;
    
    @Max(message = "最大值",value = 30)
    private Long width;

    @Min(message = "最小值",value = 30)
    private Long height;

    @DecimalMin(message = "最小值",value = "30")
    private Integer speed;

    @DecimalMax(message = "小大值" ,value = "80")
    private BigDecimal value;

    @Size(message = "在一个范围中",min = 4,max = 50)
    private List<Integer> size;

    @Past(message = "在过去时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime date;

    @Pattern(message = "必须全部是数字",regexp = "^[\\u4e00-\\u9fa5]+$")
    private String deep;

    //需要注意
    @Length(min = 5,max = 10,message = "最小五个")
    private String len;

    @NotEmpty(message = "字符串必须非空")
    private String test;

    @Range(message = "在范围里",min = 2,max = 30)
    private String ran;
}
